/**
 * 表单非空验证
 * @param names
 * @returns {Boolean}
 */
function checkBlank(names){
	var msg = "请输入 "
	if(names != '' && names != null){
		if(names.indexOf(";")>0){
			var arr =names.split(";");
			for(i = 0; i < arr.length; i++){
				if($("#"+arr[i].split(",")[0]+"").val()==''){
					msgError(msg+""+arr[i].split(",")[1]);
					return false;				
				}
			}
			return true;
		}else{
			if($("#"+names).val() == ''){
				var arr = names.split(",");
				msgError(msg+""+arr[1]);
				return false;
			}else{
				return true;
			}
		}
	}
	return false;
}

/**
 * 检验用户名
 * @param checkId
 * @param showMsgId 显示提示信息ID
 */
function checkUserNameRules(checkId,showMsgId){
	var check = $("#"+checkId+"").val();
	var reg = !!check.match(/^[a-zA-Z\d]\w{3,11}[a-zA-Z\d]$/);
	if((reg == false || check.length>11) && check.length > 0){
		$("#"+showMsgId+"").text("请填写正确的用户名!");
		return false;
	} 
	$("#"+showMsgId+"").text("");
	return true;
}

/**
 * 检验手机号码
 * @param checkId
 * @param showMsgId 显示提示信息ID
 */
function checkContactRules(checkId,showMsgId){
	var check = $("#"+checkId+"").val();
	var reg = !!check.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/);
	if((reg == false || check.length>11) && check.length > 0){
		$("#"+showMsgId+"").text("请正确填写手机号!");
		return false;
	} 
	$("#"+showMsgId+"").text("");
	return true;
}

/**
 * 检验密码
 * @param checkId 密码ID
 * @param showMsgId 显示提示信息ID
 */
function checkPwdRules(checkId,showMsgId){
	var check = $("#"+checkId+"").val();
	var reg = !!check.match(/^[a-zA-Z0-9]{6,20}$/);
	if(reg == false && check.length > 0){
		$("#"+showMsgId+"").text("您输入的格式有误!");
		return false;
	} 
	$("#"+showMsgId+"").text("");
	return true;
}

/**
 * 检验确定密码
 * @param checkId
 * @param qcheckId
 * @param showMsgId 显示提示信息ID
 */
function checkQpwdRules(checkId,qcheckId,showMsgId){
	var check1 = $("#"+checkId+"").val();
	var check2 = $("#"+qcheckId+"").val();
	if(check1 != check2 && check2.length > 0){
		$("#"+showMsgId+"").text("两次密码不一致!");
		return false;
	}
	$("#"+showMsgId+"").text("");
	return true;
}

/**
 * 检验邮箱
 * @param checkId
 * @param showMsgId 显示提示信息ID
 */
function checkEmailRules(checkId,showMsgId){
	var check = $("#"+checkId+"").val();
	var reg = !!check.match(/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/);
	if(reg == false && check.length > 0){
		$("#"+showMsgId+"").text("邮箱格式不正确，请重新输入!");
		return false;
	} 
	$("#"+showMsgId+"").text("");
	return true;
}


/**
 * 检验身份证号码
 * @param checkId
 * @param showMsgId 显示提示信息ID
 */
function checkCradRules(checkId,showMsgId){
	var check = $("#"+checkId+"").val();
	var reg= !!check.match(/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/);
	if(reg == false && check.length > 0){
		$("#"+showMsgId+"").text("身份证格式错误!");
		return false;
	}
	$("#"+showMsgId+"").text("");
	return true;
}


/**  消息提示类型  **/

function msgInfo(msg){
	window.wxc.xcConfirm(msg,window.wxc.xcConfirm.typeEnum.info);
}

function msgConfirm(msg){
	window.wxc.xcConfirm(msg,window.wxc.xcConfirm.typeEnum.confirm);
}
			
function msgWarning(msg){
	window.wxc.xcConfirm(msg,window.wxc.xcConfirm.typeEnum.warning);
}
			
function msgError(msg){
	window.wxc.xcConfirm(msg,window.wxc.xcConfirm.typeEnum.error);
}
			
function msgSuccess(msg){
	window.wxc.xcConfirm(msg,window.wxc.xcConfirm.typeEnum.success);
}

function msgInput(msg){
	window.wxc.xcConfirm(msg, window.wxc.xcConfirm.typeEnum.input,{
		onOk:function(v){
			alert(v);
		}
	});
}
			
function msgOption(msg){
	var option = {
		title: "素材家园",
		btn: parseInt("0011",2),
		onOk: function(){
			alert("确认啦");
		},
		onCancel:function(){
			alert("取消啦");	
		},
		onClose:function(){
			alert("关闭啦");	
		}
	}
	window.wxc.xcConfirm(msg, "custom", option);
}
			
function msgDefault(msg){
	window.wxc.xcConfirm(msg);
}